package in.muton.edushare.errorPages;

import javax.servlet.http.HttpServletResponse;

import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;

import com.edushare.common.constants.URLConstants;

import in.muton.edushare.EduSharePage;
import in.muton.edushare.EduShareSession;
import in.muton.edushare.pages.FooterLinks;
import in.muton.edushare.url.URLLoader;

public class PageNotFound extends EduSharePage {

	public PageNotFound() {
		BookmarkablePageLink<Void> headerLoginLink = 
			new BookmarkablePageLink<Void>("loginLink", URLLoader.getPageClass(URLConstants.LOGIN_PATH));
		if(EduShareSession.get().isLoggedIn()){
			headerLoginLink.add(new Label("loginTxt", "Go back to Home"));
		}else{
			headerLoginLink.add(new Label("loginTxt", "Login"));
		}
		add(headerLoginLink);
		
		add(new BookmarkablePageLink<Void>("loginPage", URLLoader.getPageClass(URLConstants.LOGIN_PATH)));
		add(new FooterLinks("footerLinks"));
	}
	
	@Override
	protected void configureResponse() {
		super.configureResponse();
		getWebRequestCycle().getWebResponse().getHttpServletResponse().setStatus(HttpServletResponse.SC_NOT_FOUND);
	}

	@Override
	public boolean isVersioned() {
		return false;
	}

	@Override
	public boolean isErrorPage() {
		return true;
	}
}
